<template>
  <bazi-section title="八字神煞">
    <view class="shensha-box" v-if="isVip != 1">
      <uni-collapse ref="collapse" v-model="collapseValue">
        <template v-for="(value, key, index) in shenshaList">
          <uni-collapse-item title-border="none" :border="false" :key="index">
            <template v-slot:title>
              <view class="title">{{ key }}</view>
            </template>
            <view class="content">
              <view v-for="(e, i) in value" :key="i">
                <view v-if="i == 0" class="shensha-calc">{{ e }}</view>
                <view v-else class="shensha-content">{{ e }}</view>
              </view>
            </view>
          </uni-collapse-item>
        </template>
      </uni-collapse>
    </view>
    <view v-else>
      <no-vip></no-vip>
    </view>
  </bazi-section>
</template>
<script>
import { mapGetters } from "vuex";
import baziSection from "./section.vue";
export default {
  components: {
    baziSection,
  },
  props: {
    result: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      baziResult: this.result,
      collapseValue: ["0"],
    };
  },
  computed: {
    shenshaList: function () {
      let obj = {};
      for (let key in this.baziResult.shenShaDesc) {
        if (this.baziResult.shenShaDesc[key][0] != "") {
          obj[key] = this.baziResult.shenShaDesc[key];
        }
      }
      return obj;
    },
    ...mapGetters({
      isVip: "user/isVip",
    }),
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.shensha-box {
  width: 650rpx;
  margin: auto;
  padding: 32rpx 0;
  .uni-collapse-item {
    padding: 32rpx 0;
    border-bottom: 2rpx solid #ebeef5;
  }
  .title {
    color: #000;
    font-size: 32rpx;
    font-weight: bold;
    display: flex;
    flex-direction: row;
    align-items: center;
    // padding: 32rpx 0;
  }
  .shensha-calc {
    color: #787878;
    padding-top: 4rpx;
  }

  .shensha-content {
    color: #000;
    padding-top: 50rpx;
    letter-spacing: 0.1em;
  }
}
</style>
